<?php $this->load->view('header'); ?>
    
        <div id="title_background">
            <div class="wrapper"><!-- 900px wrapper -->
                
            	<h1>Profile</h1>
                <!--<span class="title_description">This is big typography page. Here you could describe your page or leave it blank.</span>-->
                
            </div> <!-- 900px wrapper -->
        </div>
   	
	</div>
    <div class="cleaner"></div>
    <div id="position_navi"><a href="index.html">Beranda</a> / <a href="pages.html">Profile</a> </div>
    <div id="content">
    
    	<article>
       	<h1><?php $profile = $user[0];	echo $profile['nama'];?></h1>
		<p>
			<img src="<?php echo base_url()."images/user_avatars/".$profile['foto'];?>" class="profile_avatar">
			<table class="style1 profile">
				<tr>
                	<td class="first">Username</td>
					<td class="first"> : </td>
                   	<td><?php echo $profile['username'];?></td>
                </tr>
				<tr>
                	<td class="first">Gender</td>
					<td class="first"> : </td>
                   	<td><?php echo ($profile['jk'] == 'l') ? 'Laki-laki' : 'Perempuan' ;?></td>
                </tr>
            	<tr>
                	<td class="first">Pekerjaan</td>
					<td class="first"> : </td>
                   	<td><?php echo $profile['pekerjaan'];?></td>
                </tr>
                <tr>
                	<td class="first">Alamat</td>
					<td class="first"> : </td>
                   	<td><?php echo $profile['alamat'];?></td>
                </tr>
				<tr>
                	<td class="first">Telepon</td>
					<td class="first"> : </td>
                   	<td><?php echo $profile['telepon'];?></td>
                </tr>
				<tr>
                	<td class="first">E-mail</td>
					<td class="first"> : </td>
                   	<td><?php echo $profile['email'];?></td>
                </tr>
				<tr>
                	<td class="first">No Handphone</td>
					<td class="first"> : </td>
                   	<td><?php echo $profile['hp'];?></td>
                </tr>
				<tr>
                	<td class="first">Status</td>
					<td class="first"> : </td>
                   	<td><?php echo $profile['status'];?></td>
                </tr>
            </table>
		</p>
		<?php if($profile['id_user'] == $session['id_user']){ ?>
			<a href="<?php echo base_url()."users/edit/".$profile['id_user'];?>"><button class="button" style="width: auto!important">Edit Profile</button></a>
		<?php } ?>
		</article>
		
		<!-- ARTICLE PART -->
		<article>
            <h3 class="toggle">ARTIKELKU</h3>
        </article>        
		<?php 
		if(count($articles) > 0){
			foreach($articles as $article){ ?>
				<article class="half">
					<h2><?php echo $article['judul'];?></h2>
					<!--<img class="blog_post_picture float" src="<?php echo base_url()."images/article_images/".$article['foto'];?>">-->
					<p><?php echo substr($article['isi'], 0, 350);?>
						<a class="learn_more" href="<?php echo base_url()."articles/detail/".$article['id_artikel'];?>">Selengkapnya</a>
					</p>
				</article>
			<?php } 
		}else{ ?>
			<article class="half">
				<p>Belum ada artikel yang diposting oleh <?php echo $profile['nama']; ?>.</p>
			</article>
		<?php } ?>		
		<?php if($more_article_status == 'yes'){ ?>
		<article>
			<center><a class="button" style="color:#6A6A75" href="<?php echo base_url()."users/more_article/". $profile['id_user'];?>">Lihat Artikel Lainnya</a></center>
		</article>
		<?php } ?>
		<!-- END ARTICLE PART -->
		
		<!-- PHOTO PART -->
		<article>
            <h3 class="toggle">FOTOKU</h3>
        </article>		
		<?php 
		if(count($photos) > 0){
			foreach($photos as $photo){ ?>
				<article class="quarter photo">
					<a href="<?php echo base_url()."photos/detail/".$photo['id_foto'];?>"><img class="photo-img" src="<?php echo base_url() . PHOTO_PATH . $photo['foto'];?>" /></a>
					<p><?php echo $photo['judul'];?><br/>Pada <?php echo timestamp_to_date_time($photo['waktu_posting']); ?></p>
				</article>
			<?php } 
		}else{ ?>
			<article class="half">
				<p>Belum ada foto yang diunggah oleh <?php echo $profile['nama'];?>.</p>
			</article>
		<?php } ?>		
		<?php if($more_photo_status == 'yes'){ ?>
		<article>
			<center><a class="button" style="color:#6A6A75" href="<?php echo base_url()."users/more_photo/". $profile['id_user'];?>">Lihat Foto Lainnya</a></center>
		</article>
		<?php } ?>
		<!-- END PHOTO PART -->		
		
		<!-- VIDEO PART -->
		<article>
            <h3 class="toggle">VIDEOKU</h3>
        </article>		
		<?php 
		if(count($videos) > 0){
			foreach($videos as $video){ ?>
				<article class="quarter photo">
					<a href="<?php echo base_url()."videos/detail/".$video['id_video'];?>"><?php echo get_thumbnail($video['url'], 195);?></a>
					<p><?php echo $video['judul'];?><br/>Pada <?php echo timestamp_to_date_time($video['waktu_posting']); ?></p>
				</article>
			<?php } 
		}else{ ?>
			<article class="half">
				<p>Belum ada video yang diunggah oleh <?php echo $profile['nama'];?>.</p>
			</article>
		<?php } ?>		
		<?php if($more_video_status == 'yes'){ ?>
		<article>
			<center><a class="button" style="color:#6A6A75" href="<?php echo base_url()."users/more_video/". $profile['id_user'];?>">Lihat Video Lainnya</a></center>
		</article>
		<?php } ?>
		<!-- END VIDEO PART -->
				  
	<div class="cleaner"></div>
    </div>
    <div class="cleaner"></div>
    <?php $this->load->view('footer', $footer);?>